Variables in Figma
Variables in Figma are reusable values that can be applied to supported design properties and prototype interactions. They help designers create flexible design systems, maintain consistent design tokens, and build advanced interactive prototypes with dynamic behavior.
Variables can store values such as text, numbers, colors, and Boolean states. In prototypes, variables can be changed through interactions, expressions, conditions, and variable modes, allowing interfaces to respond dynamically to user actions.
Learn professional UI/UX design and Figma prototyping with JustAcademy Figma Training and Register for Figma Course Demo.
1. What are Variables in Figma?
A variable is a reusable value that can be stored once and applied to different parts of a Figma design or prototype. Instead of manually entering the same value in multiple places, designers can create a variable and reuse it wherever required.
For example, instead of manually entering the same brand color on multiple buttons, a designer can create a color variable such as color/primary and apply it to supported properties throughout the design.
Variable
↓
Reusable Value
↓
Multiple Design Elements
↓
Consistent Design
2. Why are Variables Important?
Variables make Figma designs easier to manage, update, scale, and prototype. They are particularly useful for design systems and advanced prototypes because reusable values can drive multiple design properties and interaction states.
- Reduce repetitive design work.
- Improve design consistency.
- Make reusable values easier to maintain.
- Support themes and contextual variations.
- Support responsive design systems.
- Enable dynamic prototype behavior.
- Store user selections and interface states.
- Reduce unnecessary duplicate prototype frames.
- Support conditional prototype logic.
- Support expressions and calculations.
3. Variables for Design Systems
Variables can be used as design tokens in a design system. Designers can store reusable values such as colors, spacing, dimensions, typography-related values, and component properties where supported.
Design System
↓
Variables
├── Colors
├── Spacing
├── Typography
├── Dimensions
└── Other Values
↓
Reusable Components
4. Variables for Prototyping
Variables become especially powerful when used with prototypes. A prototype interaction can modify a variable, and connected design properties can respond to the changed value.
User Action
↓
Trigger
↓
Set Variable
↓
Variable Value Changes
↓
Connected Design Properties Update
5. Types of Variables in Figma
Figma variables commonly use four value types: String, Number, Boolean, and Color.
| Variable Type | Stores | Example | Common Use |
| String | Text values | "Welcome" | Dynamic text |
| Number | Numeric values | 100 | Counters, dimensions, calculations |
| Boolean | True/false values | true | States and visibility |
| Color | Color values | #2563EB | Colors and themes |
6. String Variables
A String variable stores text. It can be used for dynamic content such as usernames, labels, product names, messages, headings, and other text-based values.
Variable Name: userName
Type: String
Value: "Manish"
String variables are useful when the same text value needs to be reused or changed during a prototype.
7. Number Variables
A Number variable stores numeric values. Number variables are useful for counters, quantities, prices, dimensions, progress values, and calculations.
Variable Name: cartCount
Type: Number
Value: 2
cartCount = cartCount + 1
8. Boolean Variables
A Boolean variable stores either true or false. Boolean variables are useful for representing states such as menu open/closed, selected/unselected, enabled/disabled, or logged in/logged out.
Variable Name: menuOpen
Type: Boolean
Value: false
9. Color Variables
A Color variable stores a color value. Color variables are useful for design systems, themes, brand colors, backgrounds, text colors, borders, and other supported color properties.
Variable Name: colorPrimary
Type: Color
Value: #2563EB
10. Variables vs Static Values
| Static Value | Variable |
| Value is entered directly. | Value is stored and reusable. |
| Harder to update consistently. | Easier to maintain reusable values. |
| Usually represents a fixed value. | Can represent reusable or dynamic values. |
| Limited prototype behavior. | Can participate in prototype interactions. |
| Less suitable for complex dynamic prototypes. | Useful for advanced prototype behavior. |
11. What is a Variable Collection?
A variable collection is a group of related variables. Collections help organize variables so that large design systems and complex prototypes remain easier to manage.
Variable Collection: E-Commerce
├── productName
├── productPrice
├── cartCount
├── cartTotal
└── isCartOpen
12. Why Use Variable Collections?
- Organize related variables.
- Make variables easier to find.
- Separate different design-system categories.
- Improve maintainability.
- Make large projects easier to manage.
- Support multiple modes within a collection.
- Make prototype variables easier to understand.
13. Example Variable Collections
| Collection | Possible Variables |
| Colors | primary, secondary, background, text |
| Spacing | small, medium, large |
| Typography | headingSize, bodySize |
| E-Commerce | cartCount, cartTotal, productName |
| Theme | background, surface, text |
14. Creating a Variable
- Open a Figma design file.
- Open the Variables area.
- Create or select a variable collection.
- Create a new variable.
- Select the appropriate variable type.
- Give the variable a meaningful name.
- Set its initial value.
- Apply the variable to a supported design property or use it in a prototype.
15. Naming Variables
Good variable naming is important for maintaining a professional design system. Names should clearly communicate what the variable represents.
Good:
color/primary
color/background
spacing/small
spacing/medium
cart/count
user/name
theme/mode
Avoid:
color1
abc
test
value
newvariable
16. Variable Naming Structure
A structured naming convention makes variables easier to locate, understand, and maintain.
Category / Purpose / State
color / button / primary
color / button / hover
color / text / primary
spacing / layout / medium
component / button / height
17. Applying Variables to Designs
Variables can be applied to supported design properties. Once a variable is applied, changing its value can update the connected property wherever that variable is used.
Variable
↓
Apply to Property
↓
Design Element
↓
Variable Value Changes
↓
Design Updates
18. Applying String Variables to Text
A String variable can be applied to supported text content. This allows prototype content to change dynamically when the variable value changes.
Variable:
userName = "Manish"
Text Content:
User name value can be driven by the variable
String variables are useful for personalized greetings, product names, messages, labels, and localization experiments.
19. Applying Number Variables
Number variables can be applied to supported numeric properties such as dimensions and other numerical design values.
Variable:
cardWidth = 320
Design:
Card Width = cardWidth
Changing the variable value can update the associated supported design property.
20. Applying Boolean Variables
Boolean variables can be used with supported Boolean-compatible properties and prototype states.
Variable:
isMenuVisible = true
State:
Visible
If the variable changes to false, the associated supported property or prototype behavior can respond accordingly.
21. Applying Color Variables
Color variables can be applied to supported color properties such as fills, strokes, and other color-based properties.
color/primary
↓
Button Fill
↓
Primary Button
22. Variables and Design Tokens
Variables can represent design tokens such as colors, spacing, typography-related values, sizes, and other reusable design decisions.
Design Token
↓
Variable
↓
Component
↓
Multiple Screens
This approach helps maintain consistency throughout a product.
23. Variables and Themes
Variable modes can represent different contexts such as Light Mode and Dark Mode. The same variable can have different values for different modes.
Theme Collection
├── Light Mode
│ ├── Background
│ └── Text
└── Dark Mode
├── Background
└── Text
24. What are Variable Modes?
A variable can have multiple mode values, allowing the same variable to represent different values depending on the active context. Modes are useful for themes, brands, device contexts, languages, and other design variations.
| Variable | Light Mode | Dark Mode |
| Background | #FFFFFF | #111827 |
| Text | #111827 | #FFFFFF |
| Surface | #F3F4F6 | #1F2937 |
25. Changing Variable Modes in Prototypes
Variable modes can be changed during prototyping using the Set variable mode action. This allows an interaction to switch the active mode for the current page.
Click Theme Toggle
↓
Set Variable Mode
↓
Dark Mode
↓
Design Updates
26. Variables in Prototypes
Variables make prototypes more dynamic by allowing interactions to modify stored values. When a variable changes, connected design properties or prototype logic can respond accordingly.
User Action
↓
Trigger
↓
Set Variable
↓
Variable Changes
↓
UI Responds
27. Set Variable Action
The Set variable action allows a prototype interaction to set or modify the value of a variable. The value used should be compatible with the variable type.
On Click
↓
Set Variable
↓
Target: cartCount
↓
Value: cartCount + 1
28. String Variable in Prototype
String variables can be changed through prototype interactions to simulate dynamic text and selections.
Button: Select Apple
↓
On Click
↓
Set Variable
↓
productName = "Apple"
↓
Connected Content Updates
29. Number Variable in Prototype
Number variables can represent quantities, counters, prices, scores, progress values, and other numerical states.
Click +
↓
Set Variable
↓
quantity = quantity + 1
↓
Quantity Display Updates
30. Boolean Variable in Prototype
Boolean variables are useful for switching between two states.
Click Menu
↓
Set Variable
↓
menuOpen = true
↓
Menu State Updates
Another interaction can set the value to false to represent the closed state.
31. Color Variable in Prototype
Color variables can help prototypes demonstrate theme changes, selected states, and dynamic visual properties.
Theme Toggle
↓
Set Variable / Set Variable Mode
↓
Color Values Change
↓
Updated UI Theme
32. Variables and Interactive Components
Variables can work together with components and interactive component states. A variable can control supported properties while prototype interactions change the variable value.
Button Component
↓
Variable
↓
Component Property
↓
Set Variable
↓
Component Updates
33. Variables and Component Variants
Variables and component variants solve different problems but can work together. Variables can store dynamic values, while component variants can represent predefined component states and variations.
Variable Value
↓
Component Property
↓
Matching Component State
↓
Updated Component
34. Variables and Boolean Visibility
A Boolean variable can be used with supported visibility behavior and prototype states. This is useful for menus, notifications, tooltips, badges, error messages, modals, and conditional content.
showNotification = true
↓
Notification State: Visible
showNotification = false
↓
Notification State: Hidden
35. Variables and Expressions
Expressions allow variables to participate in supported calculations and dynamic prototype logic. They are especially useful with number values and conditional behavior.
itemCount = itemCount + 1
itemCount = itemCount - 1
cartTotal = price * quantity
Expressions can also be used with conditional logic to evaluate whether a condition is true or false.
36. Number Variable Expressions
Number variables can be used in mathematical expressions for counters, totals, dimensions, scores, and progress calculations.
quantity = quantity + 1
quantity = quantity - 1
total = price * quantity
remaining = total - discount
37. String Values and Dynamic Messages
String variables can be used to represent dynamic text values. Designers can use them to simulate changing labels, selections, product names, and personalized content.
firstName = "Manish"
message = "Welcome " + firstName
38. Boolean Expressions
Boolean logic can evaluate whether a condition is true or false and can be used to drive conditional prototype behavior.
IF cartCount > 0
Show Cart
ELSE
Show Empty Cart
39. Variables and Conditional Logic
Variables can store information while conditional actions use that information to determine what should happen next.
cartTotal = 1500
↓
Conditional
↓
IF cartTotal >= 1000
↓
Free Shipping
ELSE
↓
Shipping Fee
40. Variables for Shopping Cart Prototypes
Variables are highly useful for creating e-commerce prototypes. Number variables can represent quantities, prices, discounts, shipping fees, and totals.
quantity = 2
price = 500
cartTotal = price * quantity
Result:
cartTotal = 1000
41. Shopping Cart Example
Click Add to Cart
↓
Set Variable
↓
quantity = quantity + 1
↓
Calculate cartTotal
↓
Update Cart State
↓
Checkout
42. Variables for Food Delivery Prototypes
Food delivery prototypes can use variables for selected restaurant, item quantity, delivery fee, discount, total price, and order status.
restaurantName = "Pizza House"
itemCount = 2
itemPrice = 300
deliveryFee = 50
total = itemCount * itemPrice + deliveryFee
43. Variables for Banking Prototypes
Banking prototypes can use variables to represent balances, transaction amounts, selected beneficiaries, transaction status, and confirmation states.
accountBalance = 50000
transferAmount = 5000
remainingBalance = accountBalance - transferAmount
44. Variables for Quiz Applications
Variables can store the user's score, selected answer, question number, and result state.
score = 0
questionNumber = 1
answerCorrect = false
IF answerCorrect == true
score = score + 1
45. Variables for Onboarding
A Number variable can represent the current onboarding step in a prototype.
currentStep = 1
Next Button
↓
currentStep = currentStep + 1
↓
Show Next Onboarding State
46. Variables for Login States
Boolean variables can represent whether a user is logged in or logged out.
isLoggedIn = false
Click Login
↓
Set Variable
↓
isLoggedIn = true
↓
Show Dashboard State
47. Variables for Menu States
menuOpen = false
Click Menu
↓
Set Variable
↓
menuOpen = true
↓
Menu State Updates
A close interaction can set the same variable back to false.
48. Variables for Favorites
A Boolean variable can represent whether a product, article, or post has been added to favorites.
isFavorite = false
Click Heart
↓
Set Variable
↓
isFavorite = true
↓
Favorite State
49. Variables for Notifications
Boolean variables can represent notification states.
showNotification = false
Click Save
↓
Set Variable
↓
showNotification = true
↓
Success Notification State
50. Variables for Tabs
A String variable can represent the currently selected tab.
selectedTab = "Home"
Click Profile
↓
Set Variable
↓
selectedTab = "Profile"
↓
Profile Tab Becomes Active
51. Variables for Dropdowns
A String variable can represent the selected dropdown option.
selectedCountry = "India"
Click USA
↓
Set Variable
↓
selectedCountry = "USA"
↓
Dropdown State Updates
52. Variables for Filters
Variables can store filter selections such as category, price range, sort order, or selected status.
selectedCategory = "Electronics"
Apply Filter
↓
Set Variable
↓
selectedCategory
↓
Filtered Prototype State
53. Variables for Dark Mode
Light and dark themes can be represented using variable modes. A theme toggle can use the Set variable mode action to switch the current page between modes.
Theme Toggle
↓
Set Variable Mode
↓
Dark Mode
↓
Background / Text / Surface Update
54. Variables for Responsive Design
Variables can be used as reusable values in responsive design systems. For example, reusable spacing and dimension values can help maintain consistency across different layouts.
Spacing Variable
↓
Desktop Layout
↓
Tablet Layout
↓
Mobile Layout
55. Variables for Localization
String variables can be used to experiment with different text values and languages. This can help designers preview how interface content changes when different language strings are used.
Language Content
↓
String Variables
↓
English / Hindi / Other Language
↓
Updated Text Content
56. Variable Modes for Themes
Variable modes allow the same variables to have different values depending on the active mode. This is especially useful for light and dark themes or other contextual design variations.
| Variable | Light | Dark |
| Background | White | Dark Gray |
| Text | Dark | White |
| Primary | Blue | Light Blue |
57. Applying a Variable Mode
When a variable collection contains multiple modes, the appropriate mode can be selected for the relevant design or prototype context.
Variable Collection
↓
Mode Selection
↓
Light / Dark / Other Context
↓
Applied Variable Values
↓
Design Updates
58. Set Variable Mode Action
The Set variable mode action changes the active variable mode of the current page during prototyping. This is useful for interactions such as theme switching.
Click Theme Toggle
↓
Set Variable Mode
↓
Select Dark Mode
↓
Current Page Uses Dark Mode
59. Variable Modes and Expressions
Variable modes can provide different values for the same variable depending on the active context. These values can participate in supported prototype expressions and interactions.
Variable Collection
↓
Variable
↓
Active Mode
↓
Variable Value
↓
Expression / Prototype Logic
↓
Result
60. Variables and Prototype State
Variables are useful for representing prototype state. Instead of creating separate frames for every possible value or state, a variable can store information and connected properties can respond to it.
State
├── Default
├── Selected
├── Active
├── Disabled
└── Completed
61. Variables vs Component Variants
| Variables | Component Variants |
| Store reusable values. | Represent predefined component variations. |
| Can use String, Number, Boolean, and Color values. | Represent reusable component states and configurations. |
| Useful for dynamic data and values. | Useful for predefined UI states. |
| Can participate in expressions and prototype logic. | Can be switched through component interactions and properties. |
| Can support multiple modes. | Can contain multiple variants. |
62. Variables and Components Together
Variables and components can be combined to create reusable and dynamic UI systems. A variable can control supported component properties while interactions can change the variable.
User Interaction
↓
Set Variable
↓
Component Property Changes
↓
Component State Updates
↓
UI Updates
63. Variables and Prototyping Expressions
Expressions make variables more powerful by allowing supported calculations and dynamic values. They can be used with Set variable actions and conditional logic.
Set Variable:
cartTotal = price * quantity
Conditional:
IF cartTotal >= 1000
Free Shipping
64. Variables and Multiple Actions
A prototype trigger can contain multiple actions. A variable can be updated as one action while another action changes the prototype presentation or navigation state.
On Click
↓
Set Variable
↓
Update State
↓
Open Overlay
↓
Show Result
65. Practical Example: Product Selector
Create a product selector using a String variable.
Variable:
selectedProduct = "Apple"
Apple Button
↓
Set Variable
↓
selectedProduct = "Apple"
Orange Button
↓
Set Variable
↓
selectedProduct = "Orange"
A connected text value or prototype state can represent the selected product.
66. Practical Example: Quantity Counter
Use a Number variable for a product quantity counter.
quantity = 1
Click +
↓
quantity = quantity + 1
Click -
↓
quantity = quantity - 1
The displayed quantity can respond to the variable value.
67. Practical Example: Shopping Cart Total
price = 500
quantity = 2
cartTotal = price * quantity
Result:
cartTotal = 1000
This can be extended with discounts, taxes, shipping fees, and conditional free-shipping rules.
68. Practical Example: Dark Mode Toggle
Light Mode
↓
Click Toggle
↓
Set Variable Mode
↓
Dark Mode
↓
Theme Values Update
69. Practical Example: Notification State
showNotification = false
Click Save
↓
Set Variable
↓
showNotification = true
↓
Success Message State
70. Practical Example: Login Validation
isLoggedIn = false
Click Login
↓
Set Variable
↓
isLoggedIn = true
↓
Conditional
↓
IF isLoggedIn
↓
Dashboard
ELSE
↓
Login Error
71. Practical Example: Quiz Application
score = 0
Correct Answer
↓
Set Variable
↓
score = score + 1
↓
Next Question
Final Question
↓
Conditional
↓
Display Result
72. Practical Example: Food Delivery App
itemCount = 0
itemPrice = 250
deliveryFee = 50
Add Food
↓
itemCount = itemCount + 1
↓
subtotal = itemCount * itemPrice
↓
total = subtotal + deliveryFee
↓
Checkout
73. Practical Example: Mobile Banking
balance = 50000
transferAmount = 5000
Confirm Transfer
↓
Conditional
↓
IF transferAmount <= balance
↓
balance = balance - transferAmount
↓
Success
ELSE
↓
Insufficient Balance
74. Practical Example: E-Commerce Filters
selectedCategory = "All"
Click Electronics
↓
Set Variable
↓
selectedCategory = "Electronics"
↓
Update Filtered State
75. Variables and Accessibility Testing
Variables can help designers test different content states, text lengths, visibility conditions, and UI states. This can help identify layouts that break when content or state changes.
- Test long text.
- Test empty values.
- Test selected and unselected states.
- Test visible and hidden content.
- Test different numerical values.
- Test different themes.
76. Variables and Edge Cases
Professional prototypes should not only demonstrate the ideal flow. Variables can help simulate edge cases such as empty carts, maximum quantities, incorrect login states, failed transactions, long usernames, and unavailable products.
Normal State
↓
Variable Changes
↓
Edge Case
↓
Conditional
↓
Error / Empty / Success State
77. Common Problems with Variables
- Using the wrong variable type.
- Using inconsistent variable names.
- Applying a variable to an unsupported or incorrect property.
- Forgetting to update variable values.
- Creating unnecessary duplicate variables.
- Using overly complex variable structures.
- Forgetting variable modes when multiple contexts are required.
- Not testing variable changes in Preview.
78. Common Problems with Variable Expressions
- Using unsupported expression syntax.
- Mixing incompatible value types.
- Using the wrong variable name.
- Creating calculations with incorrect logic.
- Not checking the initial variable value.
- Not testing boundary conditions.
- Forgetting to test the final prototype state.
79. Best Practices for Variables
- Use meaningful variable names.
- Organize variables into logical collections.
- Use consistent naming conventions.
- Choose the correct variable type.
- Avoid creating unnecessary variables.
- Use variables for genuinely reusable values.
- Use Boolean variables for simple two-state logic.
- Use Number variables for counters and calculations.
- Use String variables for dynamic text values.
- Use Color variables for reusable color values.
- Use modes when the same variable requires different contextual values.
- Test every variable-driven interaction.
80. Best Practices for Variable Modes
- Use clear mode names such as Light and Dark.
- Keep values consistent and intentional between modes.
- Use modes for genuine contextual variations.
- Avoid creating unnecessary modes.
- Test mode switching in prototypes.
- Document the purpose of each mode.
- Use components and reusable patterns to reduce repeated interactions where appropriate.
81. Variables Workflow
Identify Reusable Value
↓
Create Collection
↓
Create Variable
↓
Select Variable Type
↓
Set Initial Value
↓
Apply Variable
↓
Create Prototype Interaction
↓
Set Variable
↓
Test
↓
Refine
82. Advanced Variables Workflow
Create Variables
↓
Create Modes
↓
Apply Variables
↓
Create Components
↓
Create Prototype Triggers
↓
Set Variable
↓
Use Expressions
↓
Use Conditionals
↓
Test States
↓
Test Edge Cases
↓
Finalize Prototype
83. Variables Testing Checklist
- Check variable names.
- Check variable types.
- Check initial values.
- Check applied properties.
- Check prototype triggers.
- Check Set variable actions.
- Check expressions.
- Check conditional logic.
- Check variable modes.
- Check component interactions.
- Check empty states.
- Check error states.
- Check maximum and minimum values.
- Test complete user journeys.
84. Variables Quick Revision
| Concept | Meaning |
| Variable | Reusable stored value. |
| String | Stores text values. |
| Number | Stores numeric values. |
| Boolean | Stores true or false values. |
| Color | Stores color values. |
| Collection | Group of related variables. |
| Mode | Alternative value set for variables. |
| Set Variable | Changes a variable value during prototyping. |
| Set Variable Mode | Changes the active variable mode. |
| Expression | Calculates or manipulates supported variable values. |
| Conditional | Uses logic based on values or conditions. |
85. Interview Questions
- What are variables in Figma?
- Why are variables useful in Figma?
- What are the main variable types in Figma?
- What is a String variable?
- What is a Number variable?
- What is a Boolean variable?
- What is a Color variable?
- What is a variable collection?
- Why should variables be organized into collections?
- What are variable modes?
- How are variables used in design systems?
- How are variables used in prototypes?
- What is the Set variable action?
- What is the Set variable mode action?
- How can variables be used with interactive components?
- How can Boolean variables represent interface states?
- How can Number variables be used for a shopping cart?
- What are expressions in Figma prototypes?
- How do variables work with conditional logic?
- How can variables reduce unnecessary prototype frames?
- How can variables be used to create a dark mode prototype?
- What is the difference between variables and component variants?
- What are common mistakes when using variables?
- How should variables be named?
- How do you test a variable-driven prototype?
86. Key Takeaways
- Variables store reusable values in Figma.
- Figma supports String, Number, Boolean, and Color variable types.
- Variable collections help organize related variables.
- Variables can be applied to supported design properties.
- Variables can make prototypes dynamic.
- Set variable changes a variable value during an interaction.
- Set variable mode changes the active variable mode.
- Expressions allow supported calculations and dynamic prototype behavior.
- Conditionals allow prototypes to respond differently based on values.
- Variables can work together with components and variants.
- Variable modes are useful for themes and contextual design variations.
- Variables can simulate realistic shopping carts, forms, quizzes, dashboards, banking flows, and mobile applications.
- Good naming and organization make variables easier to maintain.
87. Learning Path
- Learn Figma Workspace.
- Learn Frames, Layers, and Components.
- Learn Introduction to Prototyping.
- Learn Prototype Connections.
- Learn Triggers and Actions.
- Learn Variables.
- Learn Variable Collections.
- Learn Variable Modes.
- Learn Set Variable.
- Learn Set Variable Mode.
- Learn Expressions.
- Learn Conditional Logic.
- Learn Interactive Components.
- Build dynamic prototypes.
- Build e-commerce and dashboard projects.
- Test realistic user journeys and edge cases.
88. Conclusion
Variables are one of the most powerful features for creating scalable design systems and advanced prototypes in Figma. They allow designers to store reusable values, apply those values across supported design properties, create different modes, modify prototype state during interactions, and build dynamic experiences without creating a separate frame for every possible state.
By combining Variables with Triggers, Actions, Expressions, Conditionals, Variable Modes, Components, and Prototyping, designers can create realistic interactive experiences such as e-commerce applications, banking applications, food delivery apps, quizzes, dashboards, onboarding flows, and theme-switching interfaces.
Recommended Learning: JustAcademy Figma Training | Register for Figma Course Demo